<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr = [2,6,1,7,4]
        let sum = 0
        let avg 
        for(let i = 0;i < arr.length; i++){
            console.log(arr[i])
            sum += arr[i]
        }
        avg = sum / arr.length
        console.log('数组的和是：' + sum, '数组的平均值是：' + avg);
        
    </script>
</body>
</html>